package com.yonyougov.devops.cruxcisupport.committest;

import com.yonyougov.devops.cruxcisupport.committest.dto.*;
import com.yonyougov.devops.cruxcisupport.committest.dto.release.ReleaseCommitTestDto;
import com.yonyougov.devops.cruxcisupport.committest.vo.*;
import com.yonyougov.devops.fwc.core.entity.Pagination;
import com.yonyougov.devops.fwc.core.service.BaseService;

import javax.servlet.ServletOutputStream;
import java.io.IOException;
import java.math.BigInteger;
import java.util.List;

/**
 * 提测表服务
 */
public interface CommitTestService extends BaseService<CommitTestEntity, BigInteger> {
    //<!--用户自定义代码开始-->

    /**
     * 开始提测/重新提测
     *
     * @param commitOrReCommitDto [com.yonyougov.devops.cruxcisupport.committest.dto.CommitOrReCommitDto]
     * @return 追踪表记录id
     */
    BigInteger commitOrReCommit(CommitOrReCommitDto commitOrReCommitDto) throws Exception;

    /**
     * 需求功能确认(还没搞完)
     *
     * @param id
     * @param attachmentUrls
     * @return
     */
    boolean funcConfirm(BigInteger id, List<String> attachmentUrls);

    /**
     * 开始测试
     *
     * @param commitTestId 提测单id
     */
    void startTest(BigInteger commitTestId);

    /**
     * 提测流程驳回
     *
     * @param rejectCommitTestDto [com.yonyougov.devops.cruxcisupport.committest.dto.RejectCommitTestDto]
     * @return boolean
     */
    boolean rejectCommitTest(RejectCommitTestDto rejectCommitTestDto);

    /**
     * 提测单作废
     *
     * @param commitTestid 提测单id
     */
    void invalidOneCommitTest(BigInteger commitTestid);

    /**
     * 测试通过
     *
     * @param passCommitTestDto [com.yonyougov.devops.cruxcisupport.committest.dto.PassCommitTestDto]
     * @return boolean
     */
    boolean passCommitTest(PassCommitTestDto passCommitTestDto);

    ///**
    // * 提测流程发版
    // *
    // * @param releaseCommitTestDto [com.yonyougov.devops.cruxcisupport.committest.dto.ReleaseCommitTestDto]
    // * @return boolean
    // * @throws Exception
    // */
    //boolean releaseCommitTest(ReleaseCommitTestDto releaseCommitTestDto) throws Exception;

    /**
     * 预发版
     *
     * @param releaseCommitTestPlusDto com.yonyougov.devops.cruxcisupport.committest.dto.release.ReleaseCommitTestPlusDto
     * @param outputStream             javax.servlet.ServletOutputStream
     */
    void preReleaseCommitTest(ReleaseCommitTestDto releaseCommitTestPlusDto, ServletOutputStream outputStream) throws IOException;

    /**
     * 提测流程发版
     *
     * @param releaseCommitTestPlusDto com.yonyougov.devops.cruxcisupport.committest.dto.release.ReleaseCommitTestPlusDto
     * @return true/false
     */
    boolean releaseCommitTestPlus(ReleaseCommitTestDto releaseCommitTestPlusDto);

    /**
     * 更改提测单
     * 根据当前用户权限
     *
     * @param updateCommitTestByCurrentUserPermissionDto [com.yonyougov.devops.cruxcisupport.committest.dto.UpdateCommitTestByCurrentUserPermissionDto]
     * @author gaoziteng
     */
    void updateCommitTestByCurrentUserPermission(UpdateCommitTestByCurrentUserPermissionDto updateCommitTestByCurrentUserPermissionDto) throws Exception;

    /**
     * 今天提测数
     *
     * @return Long
     */
    Long todayCommitTestNumber();

    /**
     * 统计驳回列表页
     *
     * @param statisticsRejectedDto com.yonyougov.devops.cruxcisupport.committest.dto.StatisticsRejectedDto
     * @return com.yonyougov.devops.fwc.core.entity.Pagination
     */
    Pagination<StatisticsRejectedVo> statisticsRejected(StatisticsRejectedDto statisticsRejectedDto);

    /**
     * 统计提测列表页
     *
     * @param statisticsCommitTestDto com.yonyougov.devops.cruxcisupport.committest.dto.StatisticsCommitTestDto
     * @return com.yonyougov.devops.fwc.core.entity.Pagination
     */
    Pagination<StatisticsCommitTestVo> statisticsCommitTest(StatisticsCommitTestDto statisticsCommitTestDto);

    /**
     * 驳回耗时按钮
     *
     * @param statisticsRejectedConsumeTimeDto com.yonyougov.devops.cruxcisupport.committest.dto.StatisticsRejectedConsumeTimeDto
     * @return java.util.List
     */
    List<StatisticsRejectedConsumeTimeVo> statisticsRejectedConsumeTime(StatisticsRejectedConsumeTimeDto statisticsRejectedConsumeTimeDto);

    /**
     * 提测列表页面
     *
     * @param queryListDto [com.yonyougov.devops.cruxcisupport.committest.vo.QueryCommitStartPageDto]
     * @return [java.util.Map]
     */
    Pagination<QueryCommitTestVo> query(QueryListDto queryListDto);

    /**
     * 根据提测id或者提测code唯一确定一个提测单
     * 提测id和提测code至少存在一个,如若都存在,走提测id
     *
     * @param queryDto com.yonyougov.devops.cruxcisupport.committest.dto.QueryCommitTestDto
     * @return com.yonyougov.devops.cruxcisupport.committest.vo.QueryCommitTestVo
     */
    QueryCommitTestVo query(QueryDto queryDto) throws Exception;

    //<!--用户自定义代码结束-->
}
